package com.dragon.annotation;

import java.sql.*;

/**
 * @author dragon
 * @since 2019/12/3
 */
public class DefaultExecuteSql implements ExecuteSql {


    private static Statement statement;

    static {
        try {
            Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/test", "root",
                    "dragon4369");
            statement = connection.createStatement();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * 执行sql语句
     *
     * @param sql 传入的sql语句
     * @throws SQLException
     */
    @Override
    public void execute(String sql) throws SQLException {
        statement.executeLargeUpdate(sql);
    }
}
